package main

import (
	"encoding/json"
	"fmt"
	"log"
)

// START OMIT
var feedJSON = []byte(`{"data": {"children": [
   {"data": {"title": "foo", "url": "http://foo"}}
]}}`)

type Feed struct {
	Data struct {
		Children []struct {
			Data struct {
				Title string `json:"title"`
				URL   string `json:"url"`
			} `json:"data"`
		} `json:"children"`
	} `json:"data"`
}

func main() {
	var feed Feed
	if err := json.Unmarshal(feedJSON, &feed); err != nil {
		log.Fatal("error parsing %q: %v", feedJSON, err)
	}
	fmt.Println(feed.Data.Children[0].Data)
}

// STOP OMIT
